<?php


namespace app\admin\validate;


use think\Validate;

class MemberConfig extends Validate
{
    //字段规则
    protected $rule = [
        'name' => 'require',
        'identify' => 'require|unique:member_config',
        'proportion' => 'require',
        'privilege' => 'require',
    ];

    //验证器提示信息
    protected $message = [
        'name.require' => '会员名字（中文不能为空）',
        'identify.require' => '会员唯一标识',
        'identify.unique' => '会员唯一标识不可重复',
        'proportion.require' => '会员价格百分比不能为空',
        'privilege.require' => '会员权益不能为空',
    ];

    //使用场景
    protected $scene = [
        'add' => ['name', 'identify', 'proportion', 'privilege'],
        'edit' => ['name', 'identify' => 'require', 'proportion', 'privilege'],
    ];
}